package storage;

import java.util.List;

import net.jcip.annotations.Immutable;
import shape.Shape;

import com.google.common.collect.Lists;

@Immutable
public class NullCanvasMemento implements Memento {

	private final List<Shape> shapes = Lists.newArrayList();

	@Override
	public List<Shape> getShapes() {
		return shapes;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((shapes == null) ? 0 : shapes.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		NullCanvasMemento other = (NullCanvasMemento) obj;
		if (shapes == null) {
			if (other.shapes != null)
				return false;
		} else if (!shapes.equals(other.shapes))
			return false;
		return true;
	}
}
